import { api } from './request'

/**
 * 文件上传相关API接口
 */
export const uploadApi = {
  /**
   * 上传文件
   * @param file 文件对象
   */
  uploadFile: (file: File) => {
    const formData = new FormData()
    formData.append('file', file)
    return api.upload('/upload/file', formData)
  },

  /**
   * 上传图片
   * @param file 图片文件对象
   */
  uploadImage: (file: File) => {
    const formData = new FormData()
    formData.append('file', file)
    return api.upload('/upload/image', formData)
  }
}